<?php


namespace App\Evaluation\Actions\Post;

use App\Extensions\Actions\RowAction;
use App\PatentApply;
use Illuminate\Http\Request;

class PatentRetrievedPost extends RowAction
{
    public $name = '检索报告';

    public function handle(PatentApply $model, Request $request)
    {
        $model->storeFile($request->file('file'), 'retrieval_report');
        return $this->response()->success('操作完成！')->refresh();
    }

    public function form()
    {
        $mimes = 'png,jpg,jpeg,pdf';
        $this->file('file', '检索报告')
            ->rules('required|mimes:' . $mimes, ['required' => '请上传检索报告', 'mimes' => '检索报告类型错误'])
            ->help('类型：' . $mimes);
    }

}
